const sql = {
	/**
	 * 获取附近门店
	 */
	selectStoresList: `select 
    store_name, 
    store_address, 
    latitude, 
    longitude,
    round(
        sqrt(
            pow(111.045 * (latitude - ?), 2) +
            pow(111.045 * (? - longitude) * cos(latitude / 57.3), 2)
        ), 2
    ) as distance_in_km
from stores
having distance_in_km <= ?
order by distance_in_km asc;`,
	/**
	 * 根据经纬度查询指定门店
	 */
	selectStores: `select * from stores 
where latitude = ?
and longitude = ?;`,
};

module.exports = sql;